package com.wanxi.arr;

import javafx.scene.transform.Scale;

import java.util.Arrays;
import java.util.Scanner;

public class MaxArrScanner {
    public static void main(String[] args) {
        int[] arr = new int[5];
        Scanner scanner = new Scanner(System.in);
//        System.out.println("请输入一个数字");
//        int a=scanner.nextInt();
//        arr[0]=a;
//        System.out.println("请输入一个数字");
//        int b=scanner.nextInt();
//        arr[1]=b;
//       对数组进行赋值
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入第" + (i + 1) + "个数字");
            int a = scanner.nextInt();
            arr[i] = a;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
//        System.out.println(Arrays.toString(arr));
//        求数组的最大值
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }
        System.out.println("数组的最小值为：" + max);

        int min = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (min > arr[i]) {
                min = arr[i];
            }
        }
        System.out.println("数组的最小值为：" + min);
    }
}
